package com.zcaxer.roomwordsample.data

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update

@Dao
interface BuildingDao {

    @Query("SELECT * from BUILDING_TABLE ORDER BY buildingID")
    fun getBuildings(): LiveData<List<Building>>

    @Update
    suspend fun updateBuilding(building : Building)

    @Insert
    fun insert(building: Building)

    @Query("UPDATE BUILDING_TABLE SET workers=:workers Where buildingID=:buildingID")
    suspend fun updateWorkers(buildingID: Int,workers: Int)

    @Query("UPDATE BUILDING_TABLE SET reserve=:reserve Where buildingID=:buildingID")
    suspend fun updateReserve(buildingID: Int,reserve: Int)


}